<?php
/******************************************************************************/
define('WDK_PATH'	,	dirname(dirname(dirname(__FILE__))).'/');
/******************************************************************************/
require WDK_PATH.'core/UnitTestConf.php';
require dirname(__FILE__).'/Class.php';
define('NAME', str_replace(WDK_PATH.'helpers/', '', dirname(__FILE__)));
class UnitTest extends PHPUnit_Framework_TestCase
{
	/**
	 *	
	 *	@author kinuz
	 *	@since 2011. 9. 30
	 */
	public function test_load()
	{
		$c = Cl::helper(NAME);
		
		$this->assertEquals($c->next(''), 'AA' , 'ERROR 1-1');
		$this->assertEquals($c->next('AA'), 'AB' , 'ERROR 1-2');
		$this->assertEquals($c->next('AZ'), 'BA' , 'ERROR 1-3');
		$this->assertEquals($c->next('BB'), 'BC' , 'ERROR 1-4');
		$this->assertEquals($c->prev('ZZ'), 'ZY' , 'ERROR 1-5');
		$this->assertEquals($c->prev('ZA'), 'YZ' , 'ERROR 1-6');
		
		$c->init(CATEGORY_NUMBER_ONLY);
		$this->assertEquals($c->next('', CATEGORY_NUMBER_ONLY), '00' , 'ERROR 2-1');
		$this->assertEquals($c->next('09', CATEGORY_NUMBER_ONLY), '10' , 'ERROR 2-2');
		$this->assertEquals($c->next('00', CATEGORY_NUMBER_ONLY), '01' , 'ERROR 2-3');
		
		
		$c->init(CATEGORY_CAPITAL_WITH_NUMBER);
		$this->assertEquals($c->next('', CATEGORY_NUMBER_ONLY), '00' , 'ERROR 3-1');
		$this->assertEquals($c->next('09', CATEGORY_NUMBER_ONLY), '0A' , 'ERROR 3-2');
		$this->assertEquals($c->next('0Z', CATEGORY_NUMBER_ONLY), '10' , 'ERROR 3-3');
		
		
		$c->init(CATEGORY_ALPHARBET);
		$this->assertEquals($c->next('', CATEGORY_NUMBER_ONLY), 'AA' , 'ERROR 4-1');
		$this->assertEquals($c->next('AA', CATEGORY_NUMBER_ONLY), 'AB' , 'ERROR 4-2');
		$this->assertEquals($c->next('AZ', CATEGORY_NUMBER_ONLY), 'Aa' , 'ERROR 4-3');
		$this->assertEquals($c->next('Az', CATEGORY_NUMBER_ONLY), 'BA' , 'ERROR 4-4');
		
		
		$c->init(CATEGORY_ALL);
		$this->assertEquals($c->next('', CATEGORY_NUMBER_ONLY), '00' , 'ERROR 5-1');
		$this->assertEquals($c->next('09', CATEGORY_NUMBER_ONLY), '0A' , 'ERROR 5-2');
		$this->assertEquals($c->next('0Z', CATEGORY_NUMBER_ONLY), '0a' , 'ERROR 5-3');
		$this->assertEquals($c->next('0a', CATEGORY_NUMBER_ONLY), '0b' , 'ERROR 5-4');
		$this->assertEquals($c->next('0z', CATEGORY_NUMBER_ONLY), '10' , 'ERROR 5-5');
	}
}
?>